<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0"/>
    <title>生成采购单</title>
    <link rel="stylesheet" href="../css/style.css"/>
    <link rel="stylesheet" href="../css/font-awesome.min.css"/>
    <link href="../css/mobiscroll_002.css" rel="stylesheet" type="text/css">
    <link href="../css/mobiscroll_003.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="container">
    <div class="header">
        <a href="index.html"><i class="icon-angle-left icon-large"></i></a>生成采购单
        <a href="../shengou/zengjiawuliao.html" class="pull-right">增加物料</a>
    </div>
    <div class="main" style="overflow-y: auto">
        <!-- 无供应商单据列表-->
        <div>
            <!-- 20160811 font28修改为font26-->
            <div class="pa1 bg-white font26">
                <span class="text-99">供应商：</span>
                <span class="text-1a">无默认供应商</span>
            </div>
            <!-- 单据列表-->
            <table class="danju bg-white">
                <tr class="bg-fa">
                    <th style="width:20%">物料名称</th>
                    <th style="width:15%">数量</th>
                    <th style="width:10%">单位</th>
                    <th style="width:15%">条只数</th>
                    <th style="width:10%">单价</th>
                    <th style="width:30%" colspan="2">申购部门</th>
                </tr>
                <tr>
                    <td class="name text-left">鲤鱼鲤鱼鲤鱼鲤鱼鲤</td>
                    <td><input type="number" placeholder="输入"/></td>
                    <td><i>ml</i></td>
                    <td><input type="number" placeholder="输入"/></td>
                    <td>250.00</td>
                    <td class="text-left" style="width:20%">前厅部门前厅部门</td>
                    <td><a href="xuanzegongyingshang.html" class="icon-yan-ju">供</a></td>
                </tr>
                <tr>
                    <td class="name text-left">鲤鱼鲤鱼鲤鱼鲤鱼鲤</td>
                    <td><input type="number" placeholder="输入"/></td>
                    <td><i>ml</i></td>
                    <td><input type="number" placeholder="输入"/></td>
                    <td>250.00</td>
                    <td class="text-left" style="width:20%">前厅部门前厅部门</td>
                    <td><a href="xuanzegongyingshang.html" class="icon-yan-ju">供</a></td>
                </tr>
            </table>
        </div>
        <!-- 有供应商单据列表-->
        <div>
            <!-- 20160811 font28修改为font26-->
            <div class="pa1 bg-white font26">
                <span>
                    <i class="text-99">供应商：</i>
                    <i class="text-1a">无默认供应商</i>
                </span>
                <span id="bezhu" class="text-main pull-right">
                    备注
                </span>

                <h3 class="mt1">
                    <span class="text-99">金额：</span>
                    <span class="text-1a">268.00</span>
                </h3>
            </div>
            <!-- 单据列表-->
            <table class="danju bg-white">
                <tr class="bg-fa">
                    <th style="width:20%">物料名称</th>
                    <th style="width:15%">数量</th>
                    <th style="width:10%">单位</th>
                    <th style="width:15%">条只数</th>
                    <th style="width:10%">单价</th>
                    <th style="width:30%">申购部门</th>
                </tr>
                <tr class="other">
                    <td class="name text-left">鲤鱼鲤鱼鲤鱼鲤鱼鲤</td>
                    <td><input type="number" placeholder="输入"/></td>
                    <td><i>ml</i></td>
                    <td><input type="number" placeholder="输入"/></td>
                    <td>250.00</td>
                    <td style="width:20%"><a href="bumen.html" class="text-main">选择</a></td>
                </tr>
                <tr>
                    <td class="name text-left">鲤鱼鲤鱼鲤鱼鲤鱼鲤</td>
                    <td><input type="number" placeholder="输入"/></td>
                    <td><i>ml</i></td>
                    <td><input type="number" placeholder="输入"/></td>
                    <td>250.00</td>
                    <td style="width:20%">前厅部门前厅部门</td>
                </tr>
            </table>
        </div>
        <div class="empty-panel">
            <p><img src="../css/img/icon-kong.png" alt="" width="94"/></p>

            <p class="font32 text-99 text-nowrap">空空如也，快去增加物料吧</p>
        </div>
    </div>
    <div class="footer">
        <a href="shanchu.html" class="btn btn-beizhu span3">删除</a>
        <button id="submitCGD" class="btn btn-submit span7" type="button">
            采购下单
        </button>
    </div>
</div>
<script src="../js/zepto.min.js"></script>
<script src="../js/msgBox.js"></script>
<script src="../js/mobiscroll_002.js" type="text/javascript"></script>
<script src="../js/mobiscroll.js" type="text/javascript"></script>
<script>
    $(function () {
        $("#startDateTime").mobiscroll().date({
            theme: "android-ics light",
            display: 'bottom',
            lang: "zh",
            dateFormat: 'yyyy-mm-dd', //返回结果格式化为年月格式
            dateOrder: 'yyyymmdd',
            setText: '下一步',
            cancelText: '取消',
            nowText: "今天",
            mode: 'scroller',
            onSelect: function (valueText) {
                console.log(valueText);
                window.location.href('shengchengcgd.html');
            }
        });
    });

    $('.sgls-item').on('click click', function () {
        $(this).find('.icon-ok').toggleClass('active');
    });

    $('#bezhu').on('click click', function () {
        $.msgbox({
            msgContent: '<textarea rows="6" placeholder="请输入" maxlength="50"></textarea>',
            showTitle: true,
            title: '备注',
            buttons: ['取消', '保存'],
            cancel: function () {
            },
            submit: function () {
//                todo 保存
            },
            close: false
        });
    });

    $('#submitCGD').on('click click', function () {
        var num = 0;
        var flag = false;
        $(".danju tr").removeClass('bg-red');
        $('.danju tr').each(function () {
            $(this).find('input').each(function () {
                if ($(this).val() == '') {
                    num++;
                    $(this).closest('tr').addClass('bg-red');
                    return false;
                }
            });
        });

        if (num == 0) {
            $.msgbox({
                msgContent: '确定提交采购单?',
                cancel: function () {
                },
                submit: function () {
//                todo 保存
                    document.location.href = 'caigoudanlsjl.html'
                },
                close: false
            });
        }
        else {
            $.msgbox({
                buttons: ['取消', '知道了'],//按钮内容
                msgContent: '您有<i class="text-red">' + num + '</i>条物料信息未填,<br/>请填写并重新提交.',
                submit: function () {
//                todo 保存

                },
                close: false
            });
        }
    });


</script>
</body>
</html>